import execjs

from utils.time_stamp import get_time_stamp
import requests
datas = {
    "pageNo": 1,
    "pageSize": 10,
    "total": 0,
    "type": "12",
    "timeType": "0",
    "ts": get_time_stamp()
}
with open("prase/1.福建公共资源网站.js","r",encoding="utf-8") as f:
    js_str = f.read()
    js_code = execjs.compile(js_str,cwd="./prase")

js_cod = js_code.call("d",datas)

print(js_cod)

headers = {

   "portal-sign": f"{js_cod}"

}

url = "https://ggzyfw.fj.gov.cn/FwPortalApi/Article/PageList"

res = requests.post(url,json=datas,headers=headers)

print(res.json()["Data"])

r = js_code.call("b",res.json()['Data'])
print(r)

















